static unsigned long next = 1;

unsigned rand0(void)
{
    next = next * 1103515245 + 12345;
    return (unsigned) (next / 65536) % 32768;
}

void srand0(unsigned seed)
{
    next = seed;
}
